Skip to content

Fixes #2655 Usage of SimulationBuilder in R#2698

Closed
rwmcintosh wants to merge 1 commit intoV13from
2655-usage-of-simulationbuilder-in-r
Closed

Fixes #2655 Usage of SimulationBuilder in R#2698
rwmcintosh wants to merge 1 commit intoV13from
2655-usage-of-simulationbuilder-in-r

Conversation

@rwmcintosh
Copy link
Member

Fixes #2655

Description

expose molecules by property after removing SimulationBuilder

Type of change

Please mark relevant options with an x in the brackets.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires documentation changes (link at least one user or developer documentation issue):
  • Algorithm update - updates algorithm documentation/questions/answers etc.
  • Other (please describe):

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Integration tests
  • Unit tests
  • Manual tests
  • No tests required

Reviewer checklist

Mark everything that needs to be checked before merging the PR.

  • Check if the code is well documented
  • Check if the behavior is what is expected
  • Check if the code is well tested
  • Check if the code is readable and well formatted
  • Additional checks (document below if any)
  • Check if documentation update issue(s) are created if the option This change requires a documentation update above is selected

Screenshots (if appropriate):

Questions (if appropriate):

{
var cache = new CacheByName<MoleculeBuilder>();
allMoleculeBuilders.Where(x => moleculeNames.Contains(x.Name)).Each(x => cache.Add(x));
return cache.ToList();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cache by name so that we only pay attention to the last merged version of a builder.

CoreSimulation = modelCoreSimulation;

// Initialize the list of molecule builders for which there are initial conditions in the simulation
_allBuildersInSimulation = allBuildersFor(allMoleculeNamesInSimulation.ToList()).DistinctBy(x => x.Name).ToList();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can build this list once at construction rather than build the list for each access.

@rwmcintosh
Copy link
Member Author

I'll add some tests here once I get some feedback that I'm on the right track. I think this is pretty much how the model constructor does adds or ignores molecules when they don't have initial conditions.

@rwmcintosh rwmcintosh self-assigned this Nov 3, 2025
Copy link
Member

@msevestre msevestre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changes are required on the .NET side anymore THe service that I have created needs to be instantiated in R and used in the simulatuon object

Where(x => x.IsPresent). // this initial condition is present
Select(ic => ic.MoleculeName).Distinct();

private IEnumerable<MoleculeBuilder> allMoleculeBuilders =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

none of this code is required . The service returning a simulation builder should be used IMO in the simulation.R alongside the simulation and saved as reference to be used with each subsequent access

@rwmcintosh
Copy link
Member Author

So this should be closed and the issue closed as well?

@rwmcintosh rwmcintosh closed this Nov 4, 2025
@msevestre
Copy link
Member

Once the R counterpart is implemented then probably.

@rwmcintosh rwmcintosh deleted the 2655-usage-of-simulationbuilder-in-r branch November 4, 2025 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants